#!/bin/bash

if [ $# -lt 1 ]
then
  echo
  echo "This script needs at least arguments!"
  exit 0
fi  


TOP_LEVEL=`pwd`
EMULATOR=$TOP_LEVEL/platform/emulator
CONTRIB=$TOP_LEVEL/contrib
SHARE=$TOP_LEVEL/share
MOZ_DIR=


if [ -n "$1" ]              # Mozart sources
then
 MOZ_DIR=$1 
fi 


TL_FILES="aclocal.m4
configure"

cd $MOZ_DIR

for file in $TL_FILES
do
	ln -sf $TOP_LEVEL/$file
done

PE_FILES="configure
configure.in
Makefile.in
Makefile.vars.in
GeSpace.cc
GeSpace.hh
GeVar.hh
board.hh
board.cc 
cac.cc
lateThread.cc
modINTERNAL.spec
boot-manager.cc
value.cc
value.hh
misc.hh
g-collect.cc
builtins.cc
var_ext.hh"

cd platform/emulator/
for file in $PE_FILES
do
	ln -sf $EMULATOR/$file
done


CT_FILES="configure
configure.in"

cd ../../contrib
for file in $CT_FILES
do
	ln -sf $CONTRIB/$file
done


GZ_FILES="configure
configure.in
Makefile.in
MozProp
GeMozProp.oz
GeMozProp-builtins.hh
GeMozProp-builtins.cc
GeIntProp-builtins.cc  
GeIntVar.oz 
GeIntProp-builtins.hh
GeIntVarDist.oz
GeIntVar-builtins.cc
GeIntVar-builtins.hh 
GeSpace-builtins.hh
misc.oz
GeIntVar.cc  
modGeIntVar.spec
GeIntVar.hh"

mkdir -p geoz
cd geoz
for file in $GZ_FILES
do
	ln -sf $CONTRIB/geoz/$file
done

SH_FILES="configure
configure.in"

cd ../../share
for file in $SH_FILES
do
	ln -sf $SHARE/$file
done

TL_FILES="Makefile.in
Browser.oz"
cd tools
for file in $TL_FILES
do
	ln -sf $SHARE/tools/$file
done

BR_FILES="constants.oz
termObject.oz
browserTerm.oz"
cd browser
for file in $BR_FILES
do
	ln -sf $SHARE/tools/browser/$file
done



echo "Remember to run configure to include geoz extension:
      ./configure --with-gecode=/usr/ --prefix=/Users/ggutierrez/mozart132 
      --enable-contrib-geoz"

